import React from 'react'
import { Route,Routes } from 'react-router-dom'
import { MainRouterModel } from '@/router/routerModel'
import { Redirect, flatRouter, getStorageItem } from '@/utils'
import DeviceType from './devicetype'

const baseRouters: MainRouterModel[] = [
  {
    path: '/sys/devicetype',
    name: '设备类型',
    icon: 'icon-gx-yonghuguanli',
    element: DeviceType
    // children: [
    //   {
    //     path: '/sys/devicetype',
    //     name: '设备类型',
    //     element: User
    //   },
    // ]
  },
]

const SysPage = () => {
  const userPermissionIds = getStorageItem('userPermissionIds', 'sessionStorage', [] as number[])
  return (
      <Routes>
        <Route index element={<Redirect to={'/sys/devicetype'} />} />
        {flatRouter(baseRouters).map((item) => {
          return <Route path={item.path.replace('/sys/', '')} element={<item.element />} key={item.path} />
        })}
      </Routes>
  )
}

export default SysPage
